<template>
  <el-container>
    <!-- 侧边栏 -->
    <el-aside>
      <div class="logo-box">
        <el-image style="width: 30px; height: 30px" :src="img"></el-image>
        <h2 class="title">小米商城个人中心</h2>
      </div>
      <el-menu
        active-text-color="#ffd04b"
        background-color="#ffffff"
        class="el-menu-vertical-demo"
        default-active="/mycenter"
        text-color="#000"
        :collapse-transition="true"
        :router="true"
      >
        <el-sub-menu index="1">
          <template #title>
            <el-menu-item index="/mycenter">
              <el-icon><User /></el-icon>
              <span>个人中心</span>
            </el-menu-item>
          </template>
          <el-menu-item index="/mycenter/mymessage">
            <el-icon><Message /></el-icon>
            <span>个人信息</span>
          </el-menu-item>
          <el-menu-item index="/mycenter/myorder">
            <el-icon><Document /></el-icon>
            <span>我的订单</span>
          </el-menu-item>
          <el-menu-item index="/mycenter/myaddress">
            <el-icon><Location /></el-icon>
            <span>收货地址</span>
          </el-menu-item>
        </el-sub-menu>
      </el-menu>
    </el-aside>
    <el-container>
      <el-header>
        <div class="h-box">
          <p class="p">点击头像退出登录</p>
          <el-dropdown>
            <span class="el-dropdown-link">
              <el-avatar :size="50" :src="img1" />
              <el-icon class="el-icon--right">
                <arrow-down />
              </el-icon>
            </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item @click="$router.push('login')"
                  >退出</el-dropdown-item
                >
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
      </el-header>
      <el-main> <router-view></router-view></el-main>
    </el-container>
  </el-container>
</template>

<script>
import { User, Message, Location, Document } from '@element-plus/icons-vue'
import img from '../../assets/1.png'
import img1 from '../../assets/dog.jpg'
// eslint-disable-next-line no-unused-vars
import router from '../../router'
export default {
  data() {
    return {
      img,
      img1
    }
  },
  methods: {},
  components: {
    User,
    Message,
    Location,
    Document
  }
}
</script>

<style lang="scss">
.el-container {
  height: 100%;
  background-color: #dfe6e9;
  .el-aside {
    width: 200px;
    background-color: white;
  }
  .el-header {
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
.logo-box {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-top: 20px;
  .title {
    font-size: 16px;
    text-align: center;
    margin-right: 10px;
  }
  .el-image {
    margin-left: 10px;
  }
}
.h-box {
  display: flex;
  position: fixed;
  right: 40px;
  align-items: center;
  .p {
    margin-right: 10px;
  }
}
</style>
